#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#define pb push_back

using namespace std;

vector<int> factor;
bool isFactor[100010];
int a[100010],n;
int getFactor(int n)
{
	memset(isFactor,-1,sizeof(isFactor));
	factor.pb(2);
	for(int i=3;i<=n;i++)
	{
		if(isFactor[i]) factor.push_back(i);
		for(int si=0;si<factor.size()&&factor[si]*i<=n;si++)
		{
			isFactor[factor[si]*i] = false;
			if(i%factor[si]==0) break;
		}
	}
}
bool legal(int pn)
{
	int ti=n/pn;
	//printf("legal pn=%d ti=%d\n",pn,ti);
	queue<int> q;
	for(int i=0;i<ti;i++) if(a[i])
		q.push(i);
	while(!q.empty())
	{
		int t=q.front();
		q.pop();
		if(t>=n) return true;
		if(a[(t+ti)%n]) q.push(t+ti);
	}
	return false;
}
int main()
{
	bool res=false;
	cin>>n;
	getFactor(n);
	for(int i=0;i<n;i++) scanf("%d",a+i);
	if(isFactor[n])
	{
		if(legal(n)) res=true;
	}
	else
	{
		for(int i=1;i<factor.size();i++) if(n%factor[i]==0&&legal(factor[i]))
			res=true;
	}
	puts(res?"YES":"NO");
	return 0;
}
